









<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>
		Usage</title>
    <link rel="stylesheet" href="./css/maven-theme.css" type="text/css" />
    <link rel="stylesheet" href="./css/maven-base.css" type="text/css"/>
    <link rel="stylesheet" href="./css/prettify.css" type="text/css"/>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
    <script type="text/javascript" src="./js/prettify.js"></script>
    <script type="text/javascript" src="./js/niftycube.js"></script>
    <script type="text/javascript">
        window.onload=function() {
            Nifty("div\#wrapper", "big");
            Nifty("div#breadcrumbs", "small");
            Nifty("div\#navcolumn", "small");
            Nifty("div.source", "medium");
            prettyPrint();
        }
    </script>
          <meta name="author" content="Jason Smith" />
        <meta name="Date-Revision-yyyymmdd" content="20120515" />
      </head>
  <body>
    <div id="wrapper">
        <div id="banner">
                        <div id="bannerLeft">
    
            jaks-quickstart
    
            </div>
                            <div class="clear">
            <hr/>
          </div>
        </div>
        <div id="breadcrumbs">
              
  

  
    
    
  
    
            <div class="xleft">
        <span id="publishDate">Last Published: 2012-05-15</span>
                  &nbsp;| <span id="projectVersion">Version: 0.0.1-SNAPSHOT</span>
                      </div>
                <div class="xright">            <a href="http://code.google.com/p/jaks/" class="externalLink">Java Kick-Start</a>
            
  

  
    
    
  
    
  </div>
          <div class="clear">
            <hr/>
          </div>
        </div>
        <div id="leftColumn">
          <div id="navcolumn">
               
  

  
    
    
  
    
                       <h5>Parent Project</h5>
            <ul>
              
    <li class="none">
                    <a href="../index.html">jaks</a>
          </li>
          </ul>
              <h5>Overview</h5>
            <ul>
              
    <li class="none">
                    <a href="index.html">Introduction</a>
          </li>
              
    <li class="none">
              <strong>Usage</strong>
        </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
                    
                  
                  
                  
                  
                  
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
          </ul>
                                               <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img class="poweredBy"
                 alt="Built by Maven"
                 src="./images/logos/maven-feather.png"
                 width="90"
                 height="30"
                 border="1" />
          </a>
                           
  

  
    
    
  
    
            </div>
        </div>
        <div id="bodyColumn">
          <div id="contentBox">
            
	
		<div class="section"><h2>Usage<a name="Usage"></a></h2>
			<p>
			<tt>jaks-quickstart</tt> is a POM-project that will to help get you up and running
			as quickly as possible. It contains:</p>
			
			<ul>
			    <li><tt>jaks-maven-plugin</tt> set up to create <tt>zip</tt> and <tt>tar.gz</tt> archives,
			    and both <tt>Bash</tt> (*nix and Mac) and <tt>Bat</tt> (Windows) launch scripts for your commands.</li>
			    <li><tt>maven-compiler-plugin</tt> set up for Java 7.</li>
			    <li><tt>maven-surefire-plugin</tt> with system properties set up to aid testing 
			    command-line scripts.</li>
			    <li>A lightweight set of dependencies including the <tt>jaks</tt> core libraries and some
			    of the Apache Commons libraries.</li>
			</ul>
			<p>The less <a class="externalLink" href="http://en.wiktionary.org/wiki/yak_shaving">yak shaving</a> you have to do 
			before you can actually write meaningful code, the better. Right?</p>
			
            <div class="section"><h3>Getting Started<a name="Getting_Started"></a></h3>
                <p>Depending on your tools, this setup should take less than five minutes, and possibly as little as one.</p>
                
                <p>First, you need to create a new Maven project.  You can do this using Eclipse or another
                IDE (they all support Maven these days), or you can simply create an empty folder on your file system.</p>
                
                <p>Second, create or modify the <tt>pom.xml</tt>. Here is a starter template for you.  You need to 
                modify a few fields: <tt>groupId</tt>, <tt>artifactId</tt>, <tt>version</tt>, <tt>name</tt>,
                and <tt>description</tt>.</p>
                <div class="source"><pre>&lt;project 
    xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; 
    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
    &lt;parent&gt;
        &lt;groupId&gt;com.googlecode.jaks&lt;/groupId&gt;
        &lt;artifactId&gt;jaks-quickstart&lt;/artifactId&gt;
        &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;/parent&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;org.your.group&lt;/groupId&gt;
    &lt;artifactId&gt;your-project-id&lt;/artifactId&gt;
    &lt;version&gt;1.2.3-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;Your Project Name&lt;/name&gt;
    &lt;description&gt;A short description of your project.&lt;/description&gt;
    &lt;repositories&gt;
        &lt;repository&gt;
            &lt;name&gt;Jaks [Snapshots]&lt;/name&gt;
            &lt;id&gt;jaks-snapshots&lt;/id&gt;
            &lt;url&gt;http://jaks.googlecode.com/svn/repo/snapshots&lt;/url&gt;
        &lt;/repository&gt;
     &lt;/repositories&gt;
&lt;/project&gt;</pre></div>
                <p>Third, you need to create a Java command. I'll use the Java package <tt>org.your.group</tt> for 
                the example, and you modify it however you like. Create this file: 
                <tt>./src/main/java/org/your/group/hello.java</tt>. Here is the source:</p>
                
                <div class="source"><pre>package org.your.group;

import com.googlecode.jaks.cli.AbstractCommand;
import com.googlecode.jaks.cli.JaksOption;

public class Hello extends AbstractCommand
{
    @JaksOption(name={&quot;w&quot;,&quot;who&quot;}, description=&quot;Who are we saying 'Hello' to?&quot;)
    public String who=&quot;World&quot;;
    
    @Override
    public void execute() throws Exception 
    {
        System.out.println(&quot;Hello, &quot; + who + &quot;.&quot;);
    }
}</pre></div>
                <p>Finally, build it.</p>
                <div class="source"><pre>$ mvn clean install</pre></div>
                <p>If you set up everything correctly, you should see a <tt>./target</tt> folder in your project,
                and it should contain <tt>.zip</tt> and <tt>.tar.gz</tt> archive file.</p>
                
                <p>Extract it.</p>
                <div class="source"><pre>$ tar -C ~/apps/extract-to -xf ./target/your-project-id-1.2.3-SNAPSHOT.tar.gz</pre></div>
                
                <p>Run it.</p>
                <div class="source"><pre>$ ~/apps/extract-to/bin/hello --who 'you intelligent person'</pre></div>
                <div><pre>Hello, you intelligent person.</pre></div>
            </div>
		</div>
	

          </div>
        </div>
        <div class="clear">
          <hr/>
        </div>
        <div id="footer">
          <div class="xright">Copyright &#169;         
   
          2012.
    
      All Rights Reserved.    
  

  
    
    
  
    
  </div>
          <div class="clear">
            <hr/>
          </div>
        </div>
    </div>
  </body>
</html>
